﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for BillGiftDAL
/// </summary>
public class BillGiftDAL
{
    DataAccess acc = new DataAccess();
    public BillGiftDAL()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    internal bool insertBillGift(int billID, string gifID, int quantity, float amount)
    {
        SqlParameter[] paraList = new SqlParameter[4];
        paraList[0] = new SqlParameter("@Bi_ID", SqlDbType.Int);
        paraList[0].Value = billID;
        paraList[1] = new SqlParameter("@G_ID", SqlDbType.NVarChar, 50);
        paraList[1].Value = gifID;
        paraList[2] = new SqlParameter("@BG_Quantity", SqlDbType.Int);
        paraList[2].Value = quantity;
        paraList[3] = new SqlParameter("@BG_Amount", SqlDbType.Float);
        paraList[3].Value = amount;

        int check = acc.executeModifier("InsertBillGift", paraList);
        if (check > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    internal DataTable getBillGiftByBiID(int biId)
    {
        SqlParameter[] paraList = new SqlParameter[1];
        paraList[0] = new SqlParameter("@Bi_ID", SqlDbType.Int);
        paraList[0].Value = biId;
        return acc.executeSelect("returnBillGiftByBiID", paraList);
    }
}